package net.openl10n.extensions;

import net.openl10n.mdf.PartId;

public final class ExtensionId implements Comparable<ExtensionId>{

	private final String id;
	
	public ExtensionId(String id) {
		if(id == null)
			throw new IllegalArgumentException("id cannot be null");
		this.id = id.intern();
	}
	@Override
	public boolean equals(Object obj) {
		if(obj == this) return true;
		if (!(obj instanceof PartId) ) return false;
		return this.id == ((ExtensionId)obj).id;
	}
	
	@Override
	public int hashCode() {
		return id.hashCode();
	}
	
	@Override
	public int compareTo(ExtensionId o) {
		return id.compareTo(o.id);
	}
	
	@Override
	public String toString() {
		return id;
	}
}
